<?php
namespace Home\Controller;
use Think\Controller;
/**
* 用户
*/
class UserController extends Controller
{
	//登陆
	function login()
	{
		$this->display();
	}

	function register(){
		header('Content-Type:text/html; charset=utf-8');
		$user=new \Model\UserModel();
		if(!empty($_POST)){
			//$_POST['user_hobby']=implode(',',$_POST['user_hobby']);//中文转字符串存入SQL

			$shuju=$user->create();
			if($shuju){
				//if($user->add($shuju)){
				echo "存入成功";
			//	}
				}else{
					//dump($user->getError());
					$this->assign('errorInfo',$user->getError());
				}
			// if($user->add($_POST)){
			// 	$this ->redirect('register',array(),3,'存入成功');
			// }else{
			// 	$this ->redirect('register',array(),3,'存入失败');
			// }
		}
		//else{
			
		// 	$this->display();
		// }

$this->display();
	}
}